//
//  InstallationDetailSystemDetailForBatteryModel.swift
//  ezyform
//
//  Created by Moennig Q on 14/9/2022.
//  Copyright © 2022 Client.Solution Pty Ltd. All rights reserved.
//

import UIKit
import HandyJSON
import RxSwift
class InstallationDetailSystemDetailForBatteryModel: NSObject, HandyJSON, Copying {
    var id: Int64 = 0//是pvd detail中此，system->battery数据的主键
    var battery_storage_id: Int64 = 0//字典中battery的id,用于修改battery信息上传用
    var battery_brand: String = ""
    var battery_series: String = ""
    @objc dynamic var battery_model: String = ""
    @objc dynamic var number_batteries: Int64 = 0
    var battery_system_part_of_an_aggregated_control: Bool = false
    var changed_the_default_battery_manufacturer_setting: Bool = false
    //battery 容量，单位是kWh
    var battery_capacity: String = ""
    //操作用
    var deleted_at: Bool = false
    var valid_flag: Bool = true//true,表示当前model是无效的，因为改了安装日期，可能会变成无效的
    var battery_rating: String {
        if let data = Double(battery_capacity), data > 0{
            let value: Double = data * Double(number_batteries)
            return Tool().formatAmountToStr(amount: "\(value)",maximumFractionDigits: 3, minimumFractionDigits: 0)
        }
        return ""
    }
    required override init() {
        
    }
    required init(original: InstallationDetailSystemDetailForBatteryModel) {
        id = original.id
        battery_storage_id = original.battery_storage_id
        battery_brand = original.battery_brand
        battery_series = original.battery_series
        battery_model = original.battery_model
        number_batteries = original.number_batteries
        battery_system_part_of_an_aggregated_control = original.battery_system_part_of_an_aggregated_control
        changed_the_default_battery_manufacturer_setting = original.changed_the_default_battery_manufacturer_setting
        battery_capacity = original.battery_capacity
        deleted_at = original.deleted_at
    }
}
